package com.sheep.springboot.controller;

import com.sheep.springboot.service.ProMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * author: sheep.Old
 * qq: 64341393
 * Created 2018/10/25
 */
@Controller
public class HelloSprboot {

    /*@Autowired
    public RedisTemplate<String, String> redisTemplate;*/


    @Autowired
    public ProMapService proMapService;

    @RequestMapping("/home")
    @ResponseBody
    public String home() {
        return "hello spring boot";
    }

    /*@RequestMapping("/redis/{key}")
    @ResponseBody
    public Object hashes(@PathVariable String key) {
        Map<Object, Object> entries = redisTemplate.opsForHash().entries(key);

        return entries;
    }*/

    @RequestMapping("/map/{day}")
    @ResponseBody
    public Object proMap(@PathVariable String day) {
        String key = "tulip:" + day + ":province";
        return proMapService.findAllMapdata(key);
    }


}
